import * as React from 'react';
import { Spin } from 'antd';

const { Suspense } = React;

export default function LazyLoad(target: any) {
  const TargetComponent = React.lazy(target);
  return (props: any) => (
    <Suspense fallback={<Spin />}>
      <TargetComponent {...props} />
    </Suspense>
  );
}
